package com.netsdk.web.controller;

import com.netsdk.demo.module.AutoRegisterModule;
import com.netsdk.lib.NetSDKLib;
import com.netsdk.web.callback.MessageCallBack;
import com.netsdk.web.callback.RegisterCallBack;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author aqie
 * @Date 2022/3/25 15:27
 * @desc
 */
@RequestMapping("test2")
@RestController
public class TestController2 {

    @PostMapping("startServer")
    public boolean startServer() {
        // 1. startServer
        boolean b = AutoRegisterModule.startServer("127.0.0.1", 8888, RegisterCallBack.getInstance());
        // 2. login
        return b;
    }

    @GetMapping("login")
    public String login(){
        // String m_strIp, int m_nPort, String m_strUser, String m_strPassword, String deviceIds
        NetSDKLib.LLong login = AutoRegisterModule.login("192.168.1.169", 37777, "admin", "yx123456", "1");
        return login.toString();
    }
}
